package com.sky.myapplication.kotlin.kotlinFragment

import android.content.Context
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import com.sky.myapplication.R

/**
 * Created by Min
 * Time 2022/10/19
 * Desc
 */
class ThreeFragment : Fragment(){

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onCreateView");

        val view = inflater.inflate(R.layout.fragment_view_page, container, false)
        return view
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onViewCreated");

        val tv_text = view.findViewById<TextView>(R.id.tv_text);

        tv_text.setBackgroundColor(resources.getColor(R.color.design_default_color_secondary))
        tv_text.setTextColor(resources.getColor(R.color.white))
        tv_text.text = "Three"
    }

    override fun onAttach(context: Context) {
        super.onAttach(context)
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onAttach");
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onCreate");
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onActivityCreated");
    }

    override fun onResume() {
        super.onResume()
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onResume");
    }

    override fun onPause() {
        super.onPause()
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onPause");
    }

    override fun onStop() {
        super.onStop()
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onStop");
    }

    override fun onDestroyView() {
        super.onDestroyView()
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onDestroyView");
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onDestroy");
    }

    override fun onDetach() {
        super.onDetach()
        Log.i(getContext()?.javaClass.toString(), "ThreeFragment onDetach");
    }
}